import java.util.List;
import java.util.ArrayList;
import java.math.BigInteger;

public class problem12 {
    public static BigInteger getTriangle(BigInteger number) {
        return number.pow(2).add(number).divide(BigInteger.valueOf(2));
    }

    public static BigInteger sumDigits(BigInteger number) {
        String numberString = number.toString();
        BigInteger sum = BigInteger.ZERO;
        for (int i = 0; i < numberString.length(); i++) {
            sum = sum.add(BigInteger.valueOf(Long.valueOf(Integer.valueOf(numberString.substring(i, i + 1)).toString())));
        }
        return sum;
    }

    public static void main(String[] args) {
        BigInteger number = BigInteger.ONE;
        BigInteger triangleNumber = BigInteger.ZERO;
        do {
            triangleNumber = getTriangle(number);
            if (triangleNumber.mod(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO) == 0) {
                if (sumDigits(triangleNumber).mod(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO) == 0) {
                    int numOfDivisors = 0;
                    for (BigInteger counter = BigInteger.ONE; counter.compareTo(triangleNumber) < 0; counter = counter.add(BigInteger.ONE)) {
                        if (triangleNumber.mod(counter).compareTo(BigInteger.ZERO) == 0) {
                            numOfDivisors++;
                        }
                    }
                    System.out.println(triangleNumber.toString() + " " + numOfDivisors);
                    if (numOfDivisors > 500) {
                        break;
                    }
                }
            }
            number = number.add(BigInteger.ONE);
        } while (true);

        System.out.println(triangleNumber.toString());
    }
}
